#ifndef STATE_H
#define STATE_H

#include "vector.h"
#include "matrix.h"
#include "object.h"
#include "particle.h"
#include <utility>
#include <vector>
#include <iostream>

class Face;

class State
{
	public:

		State();

		State(double, unsigned int, const Matrix &);

		State(const Vector &, const Vector &);

		State(double, unsigned int, const Matrix &, const Vector &, const Vector &);

		~State();

		double getT() const; //time

		unsigned int getDOF() const; //return the degree of freedom

		const Vector &getPosition() const; //return the vector of position

		void setPosition(const Vector &); //change the vector of position

		const Vector &getVelocity() const; //return the vector of velocity

		void setVelocity(const Vector &); //change the vector of velocity

		void setPositionAndVelocity(const Vector &, const Vector &); //change the vector of velocity and position

		void setParticlePositionAndVelocity(unsigned int, Vector3D, Vector3D); //change position and the velocity of a particle

		const Matrix &getReferenceMatrix() const; //reference matrix of state

		void setReferenceMatrix(const Matrix &); //change the reference matrix of state

		void setT_DOF_Ref_Col(double, unsigned int, const Matrix &, const std::vector< std::pair<bool, Object *> > &);//reference matriz, degree of freedom

		State& operator= (const State &); //operator =

        void update(const State &, double); //update state

        void setCollision(unsigned int, bool, Object *);

        std::pair<bool, Object *> getCollision(unsigned int) const;

        std::vector< std::pair<bool, Object *> > getCollision() const;

        void getParticlePositionVelocity(unsigned int, const Vector3D&, const Vector3D&, Vector3D*, Vector3D*) const; //vector of position and velocity of the particle

        Vector3D getParticlePosition(unsigned int, const Vector3D&) const; //vector of position of the particle

        Vector3D getParticleVelocity(unsigned int, const Vector3D&) const;//vector of velocity of the particle

        Vector3D getParticleNormal(Particle *) const;//vector of velocity of the particle

        void getParticleFixedState(unsigned int, bool *, bool *, bool *) const;//vector that says if the particle is fixed or not

        void setParticleState(unsigned int, bool, bool, bool, const Vector3D &, const Vector3D &);

	private:

        double t; //time

        unsigned int dof; //degree of freedom

        Matrix reference;

		Vector position, velocity;

		std::vector< std::pair<bool, Object *> > particleCollide;

};

	State operator+(const State &, const State &); //sum operator

	State operator-(const State &, const State &); //subtraction operator

	State operator*(const State &, const double &); //multiplication by a scalar

	State operator*(const double &, const State &); //multiplication operator

#endif
